//
//  TSBridgeManager.m
//  Pods-TSWebKit_Example
//
//  Created by Zac on 2020/10/27.
//

#import "TSBridgeManager.h"
#import "TSBridgeManager+Camera.h"

@interface TSBridgeManager()


@end

@implementation TSBridgeManager

- (id)initWithHandle:(id)handle
{
    if (self = [super init])
    {
        _handleVC = handle;
    }
    return self;

}

/// 访问原生系统相机
/// @param msg <#msg description#>
/// @param completionHandler <#completionHandler description#>
- (void )openCameraAndAlbum:(NSString *)msg completionHandler:(JSCallback)completionHandler;
{
    [self showMenu:^(BOOL success, NSString * _Nonnull imageBase64) {
        if (success) {
            completionHandler(imageBase64,YES);
        }
        else
        {
            completionHandler(nil,YES);
        }
    }];
}

- (void )dismissWebView:(NSString *)msg completionHandler:(JSCallback)completionHandler;
{
    if ([_handleVC navigationController]) {
        [[_handleVC navigationController] popViewControllerAnimated:YES];
    }
}



@end
